﻿
var newWin
function PopupWindowCenter(URL, title, w, h) {
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    var newWin = window.open(URL, title, 'toolbar=no, location=no,directories=no, status=no, menubar=no, scrollbars=no, resizable=no,copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
function PupupCenter(id) {
    var w = 600;
    var h = 300;
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    newWin = window.open('/diemthanhphan.aspx?id=' + id, "T", 'toolbar=no, location=no,directories=no, status=no, menubar=no, scrollbars=no, resizable=no,copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}

$(document).ready(function () {
    $(window).focus(function () {
        if (window.focus) {
            if (newWin != null) {
                newWin.close();
            }
        }
    });
    
});